package com.tuanzi.loan.web.bean.statistics.novice;

import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.request.statistics.novice.NoviceStatRequest;
import com.tuanzi.loan.vo.response.statistics.novice.NoviceTotalStatResponse;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.statistics.NoviceTotalStatLazyDataModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import java.util.Date;

/**
 * 新手引导总数统计
 * @author caiwanlin
 * @create 2018-07-30 11:26
 */
@Data
@Debug
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class NoviceTotalStatBean extends JSFListingBean<NoviceStatRequest,NoviceTotalStatResponse>{
    @PostConstruct
    public void init() throws Exception {
        initLazyDataModel();
    }

    private void initLazyDataModel() throws Exception {
        $ = new NoviceStatRequest();
        Date date = new Date();
        $.setStartTime(date);
        $.setEndTime(date);
        lazyDataModel = new NoviceTotalStatLazyDataModel($);
    }

    public void onReset() throws Exception {
        initLazyDataModel();
        /*NewOneKeyStatRequest request = new NewOneKeyStatRequest();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        request.setStartTime(format.parse("2018-06-25"));
        request.setEndTime(format.parse("2018-06-29"));
        PageSearcher<NewOneKeyStatRequest> pageSearcher = new PageSearcher<>(request, null);
        newOneKeyStatService.totalList(pageSearcher);*/
    }
}
